#!/usr/bin/env python
# -*- coding:utf-8 -*-

# file:__init__.py.py
# author:jackiex
# datetime:2022/2/7 12:50
# software: PyCharm

'''
    this is function  description 
'''

from flask_limiter import Limiter, ExemptionScope
from flask_limiter.util import get_remote_address


limiter = None


def init_limiter(app):
    global limiter
    limiter = Limiter(
        app=app,
        key_func=get_remote_address,
        default_limits=app.config.get('DEFAULT_LIMITS').split(',')
    )


def init_router(app):
    # version test
    from .apiVersionResource import apiversion_blueprint
    app.register_blueprint(apiversion_blueprint, url_prefix="/api_1_0")

    # student blueprint register
    from .studentResource import student_blueprint
    app.register_blueprint(student_blueprint, url_prefix="/api_1_0")

    # course blueprint register
    from .courseResource import course_blueprint
    app.register_blueprint(course_blueprint, url_prefix="/api_1_0")

    # ssoUser blueprint register
    from .ssoUserResource import ssouser_blueprint
    app.register_blueprint(ssouser_blueprint, url_prefix="/api_1_0")
